#ifndef __WD_Timerfd_HPP__ 
#define __WD_Timerfd_HPP__ 

#include <functional>

using TimerfdCallback = std::function<void()>;

class Timerfd
{
public:
    Timerfd(TimerfdCallback && cb, int init, int interval);
    ~Timerfd();

    void start();
    void stop();
    void handleRead();

private:
    int createTimerfd();
    void setTime(int init, int interval);

private:
    int _Timerfd;
    int _init;
    int _interval;
    TimerfdCallback _cb;
    bool _isStarted;
};

#endif

